{% extends "oj_base.html" %}
{% block title %}
    题目列表
{% endblock %}
{% block body %}
    {% load problem %}
    <div class="container main">
        <div class="row">
            <div class="col-md-9 col-lg-9">
                <div class="row">
                    <div class="right">
                        <form class="form-inline" method="get">
                            <div class="form-group-sm">
                                <input name="keyword" class="form-control" value="{{ keyword }}" placeholder="请输入关键词">
                                <input type="submit" value="搜索" class="btn btn-primary">
                            </div>
                        </form>
                    </div>
                </div>
                <div>
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th></th>
                            <th>#</th>
                            <th>题目</th>
                            <th><a href="/problems/?order_by={{ difficulty_order }}">难度</a></th>
                            <th>通过率</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for item in problems %}
                            <tr>
                                <th><span class="{% get_problem_status request.user.problems_status.problems item.id %}"></span></th>
                                <th scope="row"><a href="/problem/{{ item.id }}/">{{ item.id }}</a></th>
                                <td><a href="/problem/{{ item.id }}/">{{ item.title }}</a></td>
                                <td>
                                    {% ifequal item.difficulty 1 %}
                                        简单
                                    {% else %}
                                        {% ifequal item.difficulty 2 %}
                                            中等
                                        {% else %}
                                            难
                                        {% endifequal %}
                                    {% endifequal %}</td>
                                <td>{{ item|accepted_radio }}</td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    <nav>
                        <ul class="pager">
                            {% if previous_page %}
                                <li class="previous"><a
                                        href="/problems/{{ previous_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">
                                    <span aria-hidden="true">&larr;</span> 上一页</a></li>
                            {% endif %}
                            {% if next_page %}
                                <li class="next"><a
                                        href="/problems/{{ next_page }}/{% if keyword %}?keyword={{ keyword }}{% endif %}{% if tag %}?tag={{ tag }}{% endif %}">下一页 <span
                                        aria-hidden="true">&rarr;</span></a></li>
                            {% endif %}
                        </ul>
                    </nav>
                </div>
            </div>

            <div class="col-md-3 col-lg-3">
                {% include "oj/announcement/_announcement_panel.html" %}
                <div class="panel panel-info">
                    <div class="panel-heading">
                        <h3 class="panel-title">
                            <span class="glyphicon glyphicon-tag" aria-hidden="true"></span>
                            分类
                        </h3>
                    </div>
                    <ul class="list-group">
                        {% for item in tags %}
                            <li class="list-group-item problem-tag">
                            <a class="tag-link" href="/problems/?tag={{ item.name }}">{{ item.name }}</a>
                            <span class="badge">{{ item.problem_number }}</span>
                            </li>
                        {% endfor %}
                    </ul>
                </div>

            </div>
        </div>
    </div>
{% endblock %}

{% block js_block %}

{% endblock %}